package com.micro.modual.extension;

import com.micro.common.MicroConstant;
import com.micro.common.biz.GeneratorCodeUtil;
import com.micro.common.util.SnowFlakeUtil;
import com.micro.modual.entity.Region;
import com.micro.modual.model.bo.region.RegionBO;

/**
 * <h1>行政区划 延展类</h1>
 *
 * @author LevelCoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:23:26
 */
public class RegionExtension {

    /**
     * <h2>转换: 行政区划 新增</h2>
     *
     * @param regionBO {@link RegionBO} 行政区划 新增/修改 请求对象
     * @return {@link Region} 行政区划
     */
    public static Region converAddRegion(RegionBO regionBO) {
        Region region = new Region();
        region.setId(SnowFlakeUtil.getId());
        region.setRegionCode(regionBO.getRegionCode());
        region.setParentCode(regionBO.getParentCode());
        region.setRegionName(regionBO.getRegionName());
        region.setRegionLevel(regionBO.getRegionLevel());
        region.setRegionSort(regionBO.getRegionSort());
        region.setRegionStatus(regionBO.getRegionStatus());
        region.setRegionRemark(regionBO.getRegionRemark());
        region.setCreateTime(regionBO.getCreateTime());
        region.setUpdateTime(regionBO.getUpdateTime());
        return region;
    }

    /**
     * <h2>转换: 行政区划 修改</h2>
     *
     * @param regionBO {@link RegionBO} 行政区划 新增/修改 请求对象
     * @return {@link Region} 行政区划
     */
    public static Region converEditRegion(RegionBO regionBO) {
        Region region = new Region();
        region.setId(regionBO.getId());
        region.setRegionCode(regionBO.getRegionCode());
        region.setParentCode(regionBO.getParentCode());
        region.setRegionName(regionBO.getRegionName());
        region.setRegionLevel(regionBO.getRegionLevel());
        region.setRegionSort(regionBO.getRegionSort());
        region.setRegionStatus(regionBO.getRegionStatus());
        region.setRegionRemark(regionBO.getRegionRemark());
        region.setCreateTime(regionBO.getCreateTime());
        region.setUpdateTime(regionBO.getUpdateTime());
        return region;
    }
}
